package cn.mashiro.controller.goods;

import cn.mashiro.common.proccess.ProcessController;
import cn.mashiro.common.restful.Result;
import cn.mashiro.modules.goods.entity.dos.Brand;
import cn.mashiro.modules.goods.entity.dto.BrandPageDTO;
import cn.mashiro.modules.goods.service.BrandService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/manager/goods/brand")
public class BrandManagerController extends ProcessController {

    @Autowired
    private BrandService brandService;

    @GetMapping("/getPageInfo")
    public Result<IPage<Brand>> getPageInfo(BrandPageDTO page) {
        try {
            return renderSuccess(brandService.getBrandsByPage(page));
        } catch (Exception exception) {
            return renderError(exception);
        }
    }
}